<?php
require('common_view_functions.php');

function show_comment_author($author_name, $url)
{
	if(strlen($url) > 0) {
		return ' <a href="' . $url . '" target="_blank">' . htmlspec($author_name) . '</a>';
	} else {
		return htmlspec($author_name);
	}
}

$is_odd = TRUE;
foreach($comments as $cmt) {
?>
<div id="c<?php echo($cmt->id); ?>" class="comment <?php echo($is_odd ? 'odd' : 'even'); ?>">
	<div class="a"><img alt="" src="<?php echo('/img/avatars/' . get_avatar_name($cmt->by_blogger_id)); ?>" /></div>
	<div class="c"><div class="i"><?php echo(show_comment_author($cmt->author_name, $cmt->url) . ' @ ' . $cmt->post_time . $cmt->ip); ?><?php if($is_blog_owner) { ?> <input type="button" id="d_<?php echo($cmt->id); ?>" value="删" class="deleteCommentButton" /><?php } ?></div><?php echo($cmt->content); ?></div>
</div>
<?php
	$is_odd = !$is_odd;
}
?>
